@extends('admin.public')

@section('content')
    @if((bool)\Auth::guard('admin')->user()->is_root)
        <div class="col-md-12">
            <section class="panel panel-default text-sm doc-buttons">
                <div class="panel-body">
                    <a href="{{ route('admin.index.versions_add') }}" class="btn btn-info"><i class="icon-plus ico"></i>
                        &nbsp; 添加版本</a>
                </div>
            </section>
        </div>
    @endif

    <div class="col-lg-12">
        <div class="panel-group m-b" id="accordion2">
            @foreach($versions as $k => $version)
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2"
                           href="#collapse{{ $k }}">
                            <span class="text-info m-r">版本 : {{ $version->version }}</span>
                            <span class="text-success m-t m-r">{{ $version->updated_at }}</span>
                            <small class="text-small">{{ $version->title }}</small>
                        </a>
                        @if((bool)\Auth::guard('admin')->user()->is_root)
                            <a href="{{ route('admin.index.versions') }}?del={{ $version->id }}"
                               class="btn btn-xs btn-default pull-right">删除</a>
                            <a href="{{ route('admin.index.versions_edit',$version->id) }}"
                               class="btn btn-xs btn-default pull-right m-r">编辑</a>
                        @endif
                    </div>
                    <div id="collapse{{ $k }}" class="panel-collaps collapse {{ $k==0 ? 'in' : '' }}">
                        <div class="panel-body text-sm">{!! nl2br($version->describe) !!}</div>
                    </div>
                </div>
            @endforeach
        </div>
    </div>
@endsection

@section('css')
@endsection

@section('js')
@endsection